import quickStore from './store'
import quickHttp, { httpResponse, httpRequest } from './utils/httpRequest'
import { toPromise, setConfig, setRoutes, setForm, resetForm, cropForm, debounce } from './utils'
import {QcButton} from "qc-button";
import DetailForm from "../packages/detail-form";
import Form from "../packages/form";
import Select from "../packages/select";
import Table from "../packages/table";
import Tree from '../packages/tree'
import dayjs from 'dayjs'

const components = [
    QcButton,
    DetailForm,
    Form,
    Select,
    Table,
    Tree
];

const install = function (Vue) {
    components.forEach(component => {
        Vue.component(component.name, component)
    })
}

if (typeof window !== 'undefined' && window.Vue) {
    install(window.Vue)
}

export {
    quickHttp,
    httpRequest,
    httpResponse,
    quickStore,
    toPromise,
    setConfig,
    setRoutes,
    setForm,
    resetForm,
    cropForm,
    debounce,
    dayjs,
    QcButton,
    DetailForm,
    Form,
    Select,
    Table,
    Tree
}

export default {
    install
}
